Parsing ambiguous input with a timezone (Redux) #93
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a rebase of the tests from #27 on top of the new architecture.
When DST ends, there is an hour that is duplicated.
At the end of DST in the US, at 2am the clocks roll back an hour to 1am. Thus, given a time from 1am to 2am, it could be either before or after the rollback. The time progression is
12:00..12:59 1:00..1:59 1:00..1:59 2:00
.This is easier to understand with the offsets noted.
When DST starts, there is an hour that is lost.
At the start of DST in the US, at 2am the clocks roll forward an hour to 3am. Thus, there is no such time between 2am and 3am. The time progression is
12:00..12:59 1:00..1:59 3:00
.The assumption made in the tests below is to always 'round down'.
When DST is ending, if there are two valid times, use the one with the lower offset. This has the fault of not being able to parse
01:00+08:00
.When DST is starting, if there is no valid time, subtract the DST change (typically one hour) and use that value. This has the fault of changing the value of
02:00
to01:00
.TODO:
Zone#parse
.moment.tz.needsOffset
istrue
.